package ItemSystem;

import org.newdawn.slick.Input;
import org.newdawn.slick.geom.Vector2f;

import entity.Player;
import entity.RenderComponent;

public abstract class Item
{
	/** Images position on Screen */
	private Vector2f position;
	private float rotation = 0;
	
	private RenderComponent renderer = null;
	
	protected int itemID = 0;
	
	private String itemName; 
	
	
	/**
	 * Constructs a new item
	 * @param position - The item's position on screen
	 */
	public Item(Vector2f position, String itemName)
	{
		this.position = position;
		this.setItemName(itemName);
	}
	
	/**
	 * Item need to override this if they want to do something
	 */
	public void update(entity.Player user)
	{
		if(position.distance(user.getPosition()) < 10)
		{
			pickUp();
		}
		
		if(user.getInput().isKeyDown(Input.KEY_Q))
		{
			drop();
		}
	}
	
	
	/**
	 * Renders the item at its position
	 */
	public void render()
	{
		//TODO change this to work with new system
	}
	
	/**
	 * Statements to be performed when the object <br /> is picked up should be placed in this method
	 */
	public void pickUp()
	{
		//TODO pick up sound could go here
	}
	
	/**
	 * Drops this item.
	 * Statements to be performed when the object <br /> is picked up should be placed in this method
	 */
	public void drop()
	{
		
	}


	public Vector2f getPosition()
	{
		return position;
	}


	public void setPosition(Vector2f position) 
	{
		this.position = position;
	}


	public int getItemID()
	{
		return itemID;
	}

	public String getItemName() 
	{
		return itemName;
	}

	public void setItemName(String itemName)
	{
		this.itemName = itemName;
	}

	public float getRotation() 
	{
		return rotation;
	}

	public void setRotation(float rotation) 
	{
		this.rotation = rotation;
	}
	
}
